package kt.base


fun main() {
    baseMapForDemo()
}


fun baseMapForDemo(){
    // 只可读取，不可以写入
    val mapp = mapOf("key" to 24,"name" to "zhangsan","age" to 25)



    for ((key , value) in mapp){
        println("key = $key ; value = $value")
    }

    println("--------------------------------------------------")

    // 可读可写
    val mutableMapp = mutableMapOf("key" to 24,"name" to 10,"age" to 25)
    mutableMapp["like"] = 101
    mutableMapp.put("todo" , 102)


    println("--------------------------------------------------")

    for (key in mutableMapp.keys){
        println("key = $key ")
    }

    println("--------------------------------------------------")

    for (values in mutableMapp.entries){
        println(" value = $values")
    }
    // value = key=24

    println("--------------------------------------------------")
    mutableMapp.forEach{
        println("key = ${it.key} ; value = ${it.value}")
    }

}

fun hasMapDemo(){

    var hashMapp = hashMapOf<String , Int>("key" to 24,"name" to 10,"age" to 25)


}
